using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Tips : PutSingleton<Tips>
{
    public GameObject TipMiss, TipGreat, TipPerfect;
    public GameObject rightPos, leftPos;
    private GameObject curGo;
    public void Miss()
    {
        curGo = TipMiss;
        curGo.SetActive(true);
        iTween.MoveFrom(TipMiss, iTween.Hash("position", rightPos.transform, "easetype", iTween.EaseType.easeInQuad, "looptype", iTween.LoopType.none, "time", 1));
        iTween.ScaleFrom(TipMiss, iTween.Hash("scale", new Vector3(0.5f, 0.5f, 0.5f), "easetype", iTween.EaseType.easeInQuad, "looptype", iTween.LoopType.none, "time", 1));
        iTween.FadeFrom(TipMiss, iTween.Hash("alpha", 0.5, "easetype", iTween.EaseType.easeInQuad, "looptype", iTween.LoopType.none, "time", 1, "oncomplete", "HideTip", "oncompletetarget", gameObject));
    }

    public void Great()
    {
        curGo = TipGreat;
        curGo.SetActive(true);
        iTween.ScaleFrom(TipGreat, iTween.Hash("scale", new Vector3(0.1f, 0.1f, 0.1f), "easetype", iTween.EaseType.easeInQuad, "looptype", iTween.LoopType.none, "time", 1));
        iTween.FadeFrom(TipGreat, iTween.Hash("alpha", 0, "easetype", iTween.EaseType.easeInQuad, "looptype", iTween.LoopType.none, "time", 1, "oncomplete", "HideTip", "oncompletetarget", gameObject));
    }

    public void Perfect()
    {
        curGo = TipPerfect;
        curGo.SetActive(true);
        iTween.MoveFrom(TipPerfect, iTween.Hash("position", leftPos.transform, "easetype", iTween.EaseType.easeInQuad, "looptype", iTween.LoopType.none, "time", 1));
        iTween.ScaleFrom(TipPerfect, iTween.Hash("scale", new Vector3(0.5f, 0.5f, 0.5f), "easetype", iTween.EaseType.easeInQuad, "looptype", iTween.LoopType.none, "time", 1));
        iTween.FadeFrom(TipPerfect, iTween.Hash("alpha", 0.5, "easetype", iTween.EaseType.easeInQuad, "looptype", iTween.LoopType.none, "time", 1, "oncomplete", "HideTip", "oncompletetarget", gameObject));
    }

    private void HideTip()
    {
        curGo.SetActive(false);
    }
}
